# import requests
# import re
# from util.logger import get_logger
#
# page = 1
#
# logger = get_logger('bilibili.log')
#
# logger.info('开始爬虫')
#
#
# while True:
#     logger.info(f'开始爬第{page}页')
#     url = f'https://api.bilibili.com/pgc/season/index/result?st=1&order=3&season_version=-1&spoken_language_type=-1&area=-1&is_finish=-1&copyright=-1&season_status=-1&season_month=-1&year=-1&style_id=-1&sort=0&page={page}&season_type=1&pagesize=20&type=1'
#
#
#     headers = {
#     'user-agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36'
#     }
#
#     response = requests.get(url, headers=headers)
#
#
#     if response.status_code == 200:
#         items = response.json()['data']['list']
#
#
#         print(response.text)
#
#         for item in items:
#             print(item)
#         logger.info(f'{page}页已爬完')
#         if response.json()['data']['has_next']:
#             page += 1
#         else:
#             break
#
#
# logger.info('结束爬虫')
#
#



import requests
import re

url = 'https://api.bilibili.com/x/web-interface/wbi/index/top/feed/rcmd?web_location=1430650&y_num=4&fresh_type=3&feed_version=V8&fresh_idx_1h=2&fetch_row=1&fresh_idx=2&brush=1&device=win&homepage_ver=1&ps=10&last_y_num=4&screen=1052-808&seo_info=&tt_exp=&'
headers = {
    'user-agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36'
    }


response = requests.get(url,headers=headers)

items = response.json()['data']['item']

for item in items:
    print(item)

